<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>教务系统</title>
        <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

    </head>
	<style type="text/css">
		body{
			width: 1100px;
			height:550px;
			text-align: center;
			margin-left:auto ;
			margin-right: auto;
		}
		.div_1{
		
            border: 2px solid #7FFFD4;
            width: 1100px;
            height: 500px;
             font-size: 15pt; 
             line-height: 100%;
             font-family:rockwell;           
            }
            .div_2{
             background-image:url(img/樱花4_5.jpg)
               
            }
            .div_3 {  position: relative;
             z-index: 1;
             color:black;
       }
	</style>
      <body>
           <div class="div_1"> 
           	<hr color="cyan" size="20" />
           	<img src="img/广科logo.JPG" height="120px" width="100%" align="center"/>
             
             <div class="div_2"  >
             	<h1>教务系统登入口系统</h1> 
             <br/>
                                       用户名：<input type="text" id="account" name="usename"><br/><br/>
                                    密&nbsp;&nbsp;&nbsp;码：<input type="text" id="password" name="password"><br/><br/> 
             <p><input checked type="radio" name="identity" value="学生" />学生  &nbsp;&nbsp;&nbsp;&nbsp;
             <input type="radio" name="identity" value="教师" />教师</p>

                 <button id="submit">登录</button>
             <br />     <br />     <br /> <br /> <br /> <br />

           </div>

          
           </div>
           <img src="img/尾巴.jpg" align="center" width="100%">
           <script>

            
               $('#submit').click(
                   function () {
                       var radio = $('input[name="identity"]').filter(':checked');
                       console.log(radio)
                       var identity ="学生"
                       if(radio[0].defaultValue=='教师'){
                           identity ="教师"
                       }
                       var account = $('#account').val();
                       var password = $('#password').val();
                       $.ajax({
                           type:"POST",
                           url:"Login",
                           contentType: "application/json; charset=utf-8",
                           data:JSON.stringify({account:account,password:password}),
                           success:function(data){
                               console.log(data)
                               if (data.status!="-1"){
                                   if(identity!="教师"){
                                       window.location.href="StudentsSystem.html"
                                   }else{
                                       window.location.href="TeachersSystem.html"
                                   }

                               }else{
                                   alert("登录失败！")
                               }
                           },
                           error:function(jqXHR){
                               console.log("Error: "+jqXHR.status);
                           }
                       });
                   }
               )

           </script>
</body>
</html>
